package validator

import (
	"github.com/gin-gonic/gin/binding"
	"github.com/go-playground/validator/v10"
	"reflect"
)

func BookableDate(
	v *validator.Validate, topStruct reflect.Value, currentStructOrField reflect.Value, field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string ) bool {
	if mobile, ok := field.Interface().(string); ok {
		if mobile == "" {
			return false
		}
	}
	return true
}

func Register()  {
	v,ok := binding.Validator.Engine().(*validator.Validate)
	if ok {
		v.RegisterValidation("bookabledate", BookableDate)
	}
}